package com.banmoon.iterator;

import lombok.Data;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

@Data
public class Bookshelf implements Aggregate{

    private List<Book> bookList;

    public Bookshelf() {
        this.bookList = new ArrayList<>();
    }

    public void add(Book book){
        bookList.add(book);
    }

    @Override
    public Iterator createIterator() {
        return new BookIterator(bookList);
    }
}
